using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using yW5Lib;
using yWriter6.My.Resources;

namespace yWriter6
{
	[DesignerGenerated]
	public class frmSceneGrid : Form
	{
		private IContainer components;

		[CompilerGenerated]
		[AccessedThroughProperty("DataGridView1")]
		private DataGridView _DataGridView1;

		[CompilerGenerated]
		[AccessedThroughProperty("colChapter")]
		private DataGridViewTextBoxColumn _colChapter;

		[CompilerGenerated]
		[AccessedThroughProperty("colUnused")]
		private DataGridViewCheckBoxColumn _colUnused;

		[CompilerGenerated]
		[AccessedThroughProperty("Status")]
		private DataGridViewComboBoxColumn _Status;

		[CompilerGenerated]
		[AccessedThroughProperty("colDay")]
		private DataGridViewTextBoxColumn _colDay;

		[CompilerGenerated]
		[AccessedThroughProperty("colHour")]
		private DataGridViewTextBoxColumn _colHour;

		[CompilerGenerated]
		[AccessedThroughProperty("colMinute")]
		private DataGridViewTextBoxColumn _colMinute;

		[CompilerGenerated]
		[AccessedThroughProperty("colDate")]
		private DataGridViewTextBoxColumn _colDate;

		[CompilerGenerated]
		[AccessedThroughProperty("colTime")]
		private DataGridViewTextBoxColumn _colTime;

		[CompilerGenerated]
		[AccessedThroughProperty("colDesc")]
		private DataGridViewTextBoxColumn _colDesc;

		[CompilerGenerated]
		[AccessedThroughProperty("colVP")]
		private DataGridViewComboBoxColumn _colVP;

		private clsProject cProject;

		internal virtual DataGridView DataGridView1
		{
			[CompilerGenerated]
			get
			{
				return _DataGridView1;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				DataGridViewCellEventHandler value2 = DataGridView1_CellContentClick;
				DataGridViewCellEventHandler value3 = DataGridView1_CellEndEdit;
				DataGridView dataGridView = _DataGridView1;
				if (dataGridView != null)
				{
					dataGridView.CellContentClick -= value2;
					dataGridView.CellEndEdit -= value3;
				}
				_DataGridView1 = value;
				dataGridView = _DataGridView1;
				if (dataGridView != null)
				{
					dataGridView.CellContentClick += value2;
					dataGridView.CellEndEdit += value3;
				}
			}
		}

		[field: AccessedThroughProperty("colChapter")]
		internal virtual DataGridViewTextBoxColumn colChapter
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colUnused")]
		internal virtual DataGridViewCheckBoxColumn colUnused
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Status")]
		internal virtual DataGridViewComboBoxColumn Status
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colDay")]
		internal virtual DataGridViewTextBoxColumn colDay
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colHour")]
		internal virtual DataGridViewTextBoxColumn colHour
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colMinute")]
		internal virtual DataGridViewTextBoxColumn colMinute
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colDate")]
		internal virtual DataGridViewTextBoxColumn colDate
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colTime")]
		internal virtual DataGridViewTextBoxColumn colTime
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colDesc")]
		internal virtual DataGridViewTextBoxColumn colDesc
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("colVP")]
		internal virtual DataGridViewComboBoxColumn colVP
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[DebuggerNonUserCode]
		protected override void Dispose(bool disposing)
		{
			try
			{
				if (disposing && components != null)
				{
					components.Dispose();
				}
			}
			finally
			{
				base.Dispose(disposing);
			}
		}

		[System.Diagnostics.DebuggerStepThrough]
		private void InitializeComponent()
		{
			System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle = new System.Windows.Forms.DataGridViewCellStyle();
			DataGridView1 = new System.Windows.Forms.DataGridView();
			colChapter = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colUnused = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			Status = new System.Windows.Forms.DataGridViewComboBoxColumn();
			colDay = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colHour = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colMinute = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colDesc = new System.Windows.Forms.DataGridViewTextBoxColumn();
			colVP = new System.Windows.Forms.DataGridViewComboBoxColumn();
			((System.ComponentModel.ISupportInitialize)DataGridView1).BeginInit();
			SuspendLayout();
			DataGridView1.AllowUserToAddRows = false;
			DataGridView1.AllowUserToDeleteRows = false;
			dataGridViewCellStyle.BackColor = System.Drawing.SystemColors.ControlLightLight;
			DataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			DataGridView1.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
			DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			DataGridView1.Columns.AddRange(colChapter, colUnused, Status, colDay, colHour, colMinute, colDate, colTime, colDesc, colVP);
			DataGridView1.Location = new System.Drawing.Point(12, 12);
			DataGridView1.Name = "DataGridView1";
			DataGridView1.RowTemplate.Height = 24;
			DataGridView1.Size = new System.Drawing.Size(859, 390);
			DataGridView1.TabIndex = 0;
			colChapter.HeaderText = "Chapter";
			colChapter.Name = "colChapter";
			colChapter.ReadOnly = true;
			colUnused.HeaderText = "Unused";
			colUnused.Name = "colUnused";
			colUnused.Width = 40;
			Status.HeaderText = "Status";
			Status.Name = "Status";
			colDay.HeaderText = "Day";
			colDay.Name = "colDay";
			colHour.HeaderText = "Hour";
			colHour.Name = "colHour";
			colMinute.HeaderText = "Minute";
			colMinute.Name = "colMinute";
			colDate.HeaderText = "Date";
			colDate.Name = "colDate";
			colTime.HeaderText = "Time";
			colTime.Name = "colTime";
			colDesc.HeaderText = "Description";
			colDesc.Name = "colDesc";
			colVP.HeaderText = "Viewpoint";
			colVP.Name = "colVP";
			base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 16f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			base.ClientSize = new System.Drawing.Size(883, 473);
			base.Controls.Add(DataGridView1);
			base.Name = "frmSceneGrid";
			Text = "Scene Grid";
			((System.ComponentModel.ISupportInitialize)DataGridView1).EndInit();
			ResumeLayout(false);
		}

		public frmSceneGrid(ref clsProject ProjectClass)
		{
			base.Load += frmSceneGrid_Load;
			InitializeComponent();
			cProject = ProjectClass;
			cProject.AddedNewScene += cProject_AddedNewScene;
			cProject.AddedNewChapter += cProject_AddedNewChapter;
			cProject.SavedScene += cProject_SavedScene;
			cProject.SavedChar += cProject_SavedChar;
			FillList();
		}

		private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
		{
		}

		private void DataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
		{
		}

		private void frmSceneGrid_Load(object sender, EventArgs e)
		{
			base.Icon = Resources.yWriter5_Ico;
		}

		private void FillList()
		{
			//Discarded unreachable code: IL_00bc, IL_00d3, IL_00de, IL_00ee, IL_0138, IL_013a, IL_014e, IL_0170
			int num = default(int);
			int num3 = default(int);
			try
			{
				ProjectData.ClearProjectError();
				num = 2;
				int num2 = 2;
				DataGridView1.Rows.Clear();
				num2 = 3;
				IEnumerator enumerator = cProject.Chapters.GetEnumerator();
				while (enumerator.MoveNext())
				{
					clsChapter clsChapter = (clsChapter)enumerator.Current;
					num2 = 4;
					int sceneCount = clsChapter.SceneCount;
					for (int i = 1; i <= sceneCount; i++)
					{
						num2 = 5;
						clsScene Scene = cProject.get_SceneByChID(clsChapter.ID, i);
						num2 = 6;
						DataGridViewRow dataGridViewRow = SceneToRow(ref Scene);
						num2 = 7;
						if (dataGridViewRow != null)
						{
							num2 = 8;
							DataGridView1.Rows.Add(dataGridViewRow);
						}
						num2 = 9;
					}
					num2 = 10;
				}
				num2 = 11;
				if (enumerator is IDisposable)
				{
					(enumerator as IDisposable).Dispose();
				}
			}
			catch (Exception obj) when ((obj is Exception && num != 0) & (num3 == 0))
			{
				ProjectData.SetProjectError((Exception)obj);
				/*Error near IL_016e: Could not find block for branch target IL_013a*/;
			}
			if (num3 != 0)
			{
				ProjectData.ClearProjectError();
			}
		}

		private DataGridViewRow SceneToRow(ref clsScene Scene)
		{
			DataGridViewRow result = null;
			try
			{
				DataGridViewRow dataGridViewRow = new DataGridViewRow();
				DataGridViewTextBoxCell dataGridViewTextBoxCell = new DataGridViewTextBoxCell();
				string text = (string)(dataGridViewTextBoxCell.Value = cProject.get_ChapterByID(Scene.BelongsToChID).Title);
				dataGridViewRow.Cells.Add(dataGridViewTextBoxCell);
				result = dataGridViewRow;
				return result;
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				ProjectData.ClearProjectError();
				return result;
			}
		}

		private void cProject_AddedNewChapter(int ID)
		{
			FillList();
		}

		private void cProject_AddedNewScene(int ID)
		{
			FillList();
		}

		private void cProject_SavedScene(int ID)
		{
			clsScene Scene = cProject.get_SceneByID(ID);
			SceneToRow(ref Scene);
		}

		private void cProject_SavedChar(int ID)
		{
			//Discarded unreachable code: IL_0002, IL_0018, IL_0022, IL_002f, IL_004d, IL_004f, IL_005f, IL_0081
			int num = default(int);
			int num2 = default(int);
			try
			{
			}
			catch (Exception obj) when ((obj is Exception && num != 0) & (num2 == 0))
			{
				ProjectData.SetProjectError((Exception)obj);
				/*Error near IL_007f: Could not find block for branch target IL_004f*/;
			}
			if (num2 != 0)
			{
				ProjectData.ClearProjectError();
			}
		}
	}
}
